package client.whiteboard.controller;
import client.whiteboard.model.*;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import client.whiteboard.view.IGui;
import client.whiteboard.model.IManager;

public class GUIController extends Controller implements ChangeListener, ActionListener, MouseListener, MouseMotionListener
{
	private IGUIManager _manager;
	private IGui _gui;
	public void setManager(IGUIManager manager)
	{
		_manager = manager;
	}
	public void setGui(IGui gui)
	{
		_gui = gui;
	}
	@Override
	public void stateChanged(ChangeEvent e) {
		// TODO Auto-generated method stub
		_manager.sliderChanged(((JSlider)(e.getSource())).getValue());
		updateGui();
	}
	private void updateGui()
	{
		if(_gui != null){
			_gui.update();
		}
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		_manager.buttonPressed(e.getActionCommand());
	}

	@Override
	public void mouseClicked(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseEntered(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseDragged(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseMoved(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}
}
